<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>剑指offer | jingxiao's space</title><meta name="author" content="jingxiao"><meta name="copyright" content="jingxiao"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="剑指offer整数剑指 Offer II 001. 整数除法类似tcp慢开始的过程，注意处理溢出 剑指 Offer II 002. 二进制加法模拟加法过程 剑指 Offer II 003. 前 n 个数字二进制中 1 的个数动规，加二进制与奇偶性 剑指 Offer II 004. 只出现一次的数字数学性质 剑指 Offer II 005. 单词长度的最大乘积12345678for (int i">
<meta property="og:type" content="article">
<meta property="og:title" content="剑指offer">
<meta property="og:url" content="https://jingxiao-yz.github.io/2023/06/06/offer100/index.html">
<meta property="og:site_name" content="jingxiao&#39;s space">
<meta property="og:description" content="剑指offer整数剑指 Offer II 001. 整数除法类似tcp慢开始的过程，注意处理溢出 剑指 Offer II 002. 二进制加法模拟加法过程 剑指 Offer II 003. 前 n 个数字二进制中 1 的个数动规，加二进制与奇偶性 剑指 Offer II 004. 只出现一次的数字数学性质 剑指 Offer II 005. 单词长度的最大乘积12345678for (int i">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://jingxiao-yz.github.io/img/default_cover.jpg">
<meta property="article:published_time" content="2023-06-06T10:30:42.000Z">
<meta property="article:modified_time" content="2023-11-24T06:26:34.214Z">
<meta property="article:author" content="jingxiao">
<meta property="article:tag" content="keywordssssssss">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://jingxiao-yz.github.io/img/default_cover.jpg"><link rel="shortcut icon" href="/img/favicon.ico"><link rel="canonical" href="https://jingxiao-yz.github.io/2023/06/06/offer100/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  }
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '剑指offer',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-11-24 14:26:34'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"><link rel="alternate" href="/atom.xml" title="jingxiao's space" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/img/head.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">3</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr/></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/img/default_cover.jpg')"><nav id="nav"><span id="blog-info"><a href="/" title="jingxiao's space"><span class="site-name">jingxiao's space</span></a></span><div id="menus"><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">剑指offer</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-06-06T10:30:42.000Z" title="发表于 2023-06-06 18:30:42">2023-06-06</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-11-24T06:26:34.214Z" title="更新于 2023-11-24 14:26:34">2023-11-24</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="剑指offer"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="剑指offer"><a href="#剑指offer" class="headerlink" title=" 剑指offer"></a><center> <a target="_blank" rel="noopener" href="https://leetcode.cn/studyplan/coding-interviews-special/">剑指offer</a></center></h1><h2 id="整数"><a href="#整数" class="headerlink" title="整数"></a><center>整数</center></h2><h3 id="剑指-Offer-II-001-整数除法"><a href="#剑指-Offer-II-001-整数除法" class="headerlink" title="剑指 Offer II 001. 整数除法"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/xoh6Oh/?envType=study-plan-v2&envId=coding-interviews-special">剑指 Offer II 001. 整数除法</a></h3><p>类似tcp慢开始的过程，注意处理溢出</p>
<h3 id="剑指-Offer-II-002-二进制加法"><a href="#剑指-Offer-II-002-二进制加法" class="headerlink" title="剑指 Offer II 002. 二进制加法"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/JFETK5/?envType=study-plan-v2&envId=coding-interviews-special">剑指 Offer II 002. 二进制加法</a></h3><p>模拟加法过程</p>
<h3 id="剑指-Offer-II-003-前-n-个数字二进制中-1-的个数"><a href="#剑指-Offer-II-003-前-n-个数字二进制中-1-的个数" class="headerlink" title="剑指 Offer II 003. 前 n 个数字二进制中 1 的个数"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/w3tCBm/">剑指 Offer II 003. 前 n 个数字二进制中 1 的个数</a></h3><p>动规，加二进制与奇偶性</p>
<h3 id="剑指-Offer-II-004-只出现一次的数字"><a href="#剑指-Offer-II-004-只出现一次的数字" class="headerlink" title="剑指 Offer II 004. 只出现一次的数字"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/WGki4K/?envType=study-plan-v2&envId=coding-interviews-special">剑指 Offer II 004. 只出现一次的数字</a></h3><p>数学性质</p>
<h3 id="剑指-Offer-II-005-单词长度的最大乘积"><a href="#剑指-Offer-II-005-单词长度的最大乘积" class="headerlink" title="剑指 Offer II 005. 单词长度的最大乘积"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/aseY1I/">剑指 Offer II 005. 单词长度的最大乘积</a></h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span> (<span class="type">int</span> <span class="variable">i</span> <span class="operator">=</span> <span class="number">0</span>; i &lt; n; i++) &#123;</span><br><span class="line">    <span class="comment">// 1个int 32位，每一个二进制位代表一个字母，一个字符串含有的所有字母可以用一个int数字代表</span></span><br><span class="line">    <span class="comment">// 如‘acd’含有三个字母&#x27;a&#x27;,&#x27;c&#x27;,&#x27;d&#x27;, 二进制位表示为 &#x27;00000...001101&#x27;，也就是十进制 &#x27;13&#x27;</span></span><br><span class="line">    <span class="keyword">for</span> (<span class="type">int</span> <span class="variable">j</span> <span class="operator">=</span> <span class="number">0</span>; j &lt; words[i].length(); j++) &#123;</span><br><span class="line">        <span class="type">int</span> <span class="variable">c</span> <span class="operator">=</span> <span class="number">1</span> &lt;&lt; (words[i].charAt(j) - <span class="string">&#x27;a&#x27;</span>); <span class="comment">// 32位置中的相对偏移量，0~26</span></span><br><span class="line">        masks[i] |= c; <span class="comment">// 或 运算，有1为1</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="动态规划"><a href="#动态规划" class="headerlink" title=" 动态规划"></a><center> 动态规划</center></h2><h3 id="剑指-Offer-II-089-房屋偷盗"><a href="#剑指-Offer-II-089-房屋偷盗" class="headerlink" title="剑指 Offer II 089. 房屋偷盗"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/Gu0c2T/?envType=study-plan-v2&envId=coding-interviews-special">剑指 Offer II 089. 房屋偷盗</a></h3><p><code>dp[i]</code>定义：偷完i个房间最多能偷的钱，注意初始化</p>
<p>动态方程：<code>dp[i] = Math.max(dp[i-2] + nums[i], dp[i-1])</code></p>
<h3 id="剑指-Offer-II-090-环形房屋偷盗"><a href="#剑指-Offer-II-090-环形房屋偷盗" class="headerlink" title="剑指 Offer II 090. 环形房屋偷盗"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/PzWKhm/?envType=study-plan-v2&envId=coding-interviews-special">剑指 Offer II 090. 环形房屋偷盗</a></h3><p>分两个情况：不偷第0个，则转化为1 ~ n-1的单链；偷第0个，则转化为2 ~ n-2的单链</p>
<h3 id="剑指-Offer-II-091-粉刷房子"><a href="#剑指-Offer-II-091-粉刷房子" class="headerlink" title="剑指 Offer II 091. 粉刷房子"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/JEj789/">剑指 Offer II 091. 粉刷房子</a></h3><p>有几类状态，那就把不同的状态分别表示出来，dp数组可是是多维的，标识不同的状态</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">dp[i][0]粉刷到第i个房间并且第i个房间粉刷成红色时的最少花费</span><br><span class="line">dp[i][1]粉刷到第i个房间并且第i个房间粉刷成绿色时的最少花费</span><br><span class="line">dp[i][2]粉刷到第i个房间并且第i个房间粉刷成蓝色时的最少花费</span><br></pre></td></tr></table></figure>

<h3 id="剑指-Offer-II-092-翻转字符"><a href="#剑指-Offer-II-092-翻转字符" class="headerlink" title="剑指 Offer II 092. 翻转字符"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/cyJERH/?envType=study-plan-v2&envId=coding-interviews-special">剑指 Offer II 092. 翻转字符</a></h3><p> 若当前字符为0 ，反转当前的0-&gt;1（同时操作次数加1） 和 反转前面所有1-&gt;0（这里操作次数当然就是前面1的数量了） 看哪个代价 小</p>
<h3 id><a href="#" class="headerlink" title></a><a href></a></h3><h3 id="-1"><a href="#-1" class="headerlink" title></a><a href></a></h3><h2 id="字符串"><a href="#字符串" class="headerlink" title=" 字符串"></a><center> 字符串</center></h2><h3 id="剑指-Offer-II-015-字符串中的所有变位词"><a href="#剑指-Offer-II-015-字符串中的所有变位词" class="headerlink" title="剑指 Offer II 015. 字符串中的所有变位词"></a><a target="_blank" rel="noopener" href="https://leetcode.cn/problems/VabMRr/?envType=study-plan-v2&envId=coding-interviews-special">剑指 Offer II 015. 字符串中的所有变位词</a></h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">int</span> <span class="variable">left</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"><span class="type">int</span> <span class="variable">right</span> <span class="operator">=</span> <span class="number">0</span>;</span><br><span class="line"><span class="keyword">while</span>(right &lt; m)&#123;</span><br><span class="line">    <span class="comment">//mark数组通过遍历待匹配短字符串初始化，有些为 -n（n为字母数量），有些为0（没有那个字母），没有正数</span></span><br><span class="line">    <span class="comment">//右边指针向前走，遇到一个字母，便在原来mark数组上使对应字母位置加1，</span></span><br><span class="line">    mark[s.charAt(right) - <span class="string">&#x27;a&#x27;</span>]++;</span><br><span class="line">    <span class="comment">//理想情况下，若区间内的字母数量匹配mark，那么会使得mark刚好为全0，也不会出现正数</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">/*</span></span><br><span class="line"><span class="comment">        当右指针把最前端字母加入mark，使得mark数组对应字母位置的值大于0了</span></span><br><span class="line"><span class="comment">        说明当前区间内，要么出现了新字母种类（0-&gt;1），要么字母数量比标准的多了(-n -&gt;...-&gt; 0 -&gt; 1)</span></span><br><span class="line"><span class="comment">        这个时候，就应该改变区间位置，那就是移动区间左指针，</span></span><br><span class="line"><span class="comment">        1、 如果是字母种类多了，那左指针就会一直向前移动，直到左指针遇到右指针，</span></span><br><span class="line"><span class="comment">            当然，会把这个过程会把丢掉的字母从mark里面删除，即减1，也相当于在恢复mark数组</span></span><br><span class="line"><span class="comment">            当left遇到right，并把right位置的值减1为0时，区间长度为0了，mark数组又回到了初始状态，同时跳出内while</span></span><br><span class="line"><span class="comment">        2、 如果是字母数量多了，此时左指针向前移动，并作删除动作，比如当前right位置对应的字母是x，left在前移一半时遇到了一个x，</span></span><br><span class="line"><span class="comment">            会使mark中x位置的数量减1，这时mark数组x对应的数量变为0，跳出内while循环，现在，left和right框着剩下一半的字符，</span></span><br><span class="line"><span class="comment">            这部分字符的总数量是没有破环mark数组状态的，只要right向前移动，就有可能找到符合要求的字串，</span></span><br><span class="line"><span class="comment">            同时下面有个判断区间长度，但明显区间长度不同，所以不会记录</span></span><br><span class="line"><span class="comment">    */</span></span><br><span class="line">    <span class="keyword">while</span>(mark[s.charAt(right) - <span class="string">&#x27;a&#x27;</span>] &gt; <span class="number">0</span>)&#123;</span><br><span class="line">        mark[s.charAt(left) - <span class="string">&#x27;a&#x27;</span>]--;</span><br><span class="line">        left++;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//经过前面while，left和right区间内绝对不会出现正数，</span></span><br><span class="line">    <span class="comment">//若这个时候区间长度还和mark数组一致，那说明这个区间内的所有字母数量是与mark数组相符的，mark全0了，没出现大于0</span></span><br><span class="line">    <span class="comment">//或者，也可以用mark数组和 int[26]全0数组判等，但是直接判长度快得多</span></span><br><span class="line">    <span class="keyword">if</span>(right - left + <span class="number">1</span> == n) ans.add(left);</span><br><span class="line">    <span class="comment">// if(Arrays.equals(mark, new int[26])) ans.add(left);</span></span><br><span class="line"></span><br><span class="line">    right++;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="图"><a href="#图" class="headerlink" title=" 图"></a><center> 图</center></h2><h1 id="不刷了"><a href="#不刷了" class="headerlink" title=" 不刷了"></a><center> 不刷了</center></h1></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://jingxiao-yz.github.io">jingxiao</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://jingxiao-yz.github.io/2023/06/06/offer100/">https://jingxiao-yz.github.io/2023/06/06/offer100/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://jingxiao-yz.github.io" target="_blank">jingxiao's space</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="/img/default_cover.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="next-post pull-full"><a href="/2023/05/09/aboutstream/" title="从 FileInputStream.read() 到 Windows api ReadFile()"><img class="cover" src="/img/default_cover.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">从 FileInputStream.read() 到 Windows api ReadFile()</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/img/head.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">jingxiao</div><div class="author-info__description">记录一哈</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">3</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/jingxiao-yz"><i class="fab fa-github"></i><span>戳我</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">我来啦！</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%89%91%E6%8C%87offer"><span class="toc-number">1.</span> <span class="toc-text"> 剑指offer</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%95%B4%E6%95%B0"><span class="toc-number">1.1.</span> <span class="toc-text">整数</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-001-%E6%95%B4%E6%95%B0%E9%99%A4%E6%B3%95"><span class="toc-number">1.1.1.</span> <span class="toc-text">剑指 Offer II 001. 整数除法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-002-%E4%BA%8C%E8%BF%9B%E5%88%B6%E5%8A%A0%E6%B3%95"><span class="toc-number">1.1.2.</span> <span class="toc-text">剑指 Offer II 002. 二进制加法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-003-%E5%89%8D-n-%E4%B8%AA%E6%95%B0%E5%AD%97%E4%BA%8C%E8%BF%9B%E5%88%B6%E4%B8%AD-1-%E7%9A%84%E4%B8%AA%E6%95%B0"><span class="toc-number">1.1.3.</span> <span class="toc-text">剑指 Offer II 003. 前 n 个数字二进制中 1 的个数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-004-%E5%8F%AA%E5%87%BA%E7%8E%B0%E4%B8%80%E6%AC%A1%E7%9A%84%E6%95%B0%E5%AD%97"><span class="toc-number">1.1.4.</span> <span class="toc-text">剑指 Offer II 004. 只出现一次的数字</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-005-%E5%8D%95%E8%AF%8D%E9%95%BF%E5%BA%A6%E7%9A%84%E6%9C%80%E5%A4%A7%E4%B9%98%E7%A7%AF"><span class="toc-number">1.1.5.</span> <span class="toc-text">剑指 Offer II 005. 单词长度的最大乘积</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%8A%A8%E6%80%81%E8%A7%84%E5%88%92"><span class="toc-number">1.2.</span> <span class="toc-text"> 动态规划</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-089-%E6%88%BF%E5%B1%8B%E5%81%B7%E7%9B%97"><span class="toc-number">1.2.1.</span> <span class="toc-text">剑指 Offer II 089. 房屋偷盗</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-090-%E7%8E%AF%E5%BD%A2%E6%88%BF%E5%B1%8B%E5%81%B7%E7%9B%97"><span class="toc-number">1.2.2.</span> <span class="toc-text">剑指 Offer II 090. 环形房屋偷盗</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-091-%E7%B2%89%E5%88%B7%E6%88%BF%E5%AD%90"><span class="toc-number">1.2.3.</span> <span class="toc-text">剑指 Offer II 091. 粉刷房子</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-092-%E7%BF%BB%E8%BD%AC%E5%AD%97%E7%AC%A6"><span class="toc-number">1.2.4.</span> <span class="toc-text">剑指 Offer II 092. 翻转字符</span></a></li><li class="toc-item toc-level-3"><a class="toc-link"><span class="toc-number">1.2.5.</span> <span class="toc-text"></span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#-1"><span class="toc-number">1.2.6.</span> <span class="toc-text"></span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AD%97%E7%AC%A6%E4%B8%B2"><span class="toc-number">1.3.</span> <span class="toc-text"> 字符串</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%89%91%E6%8C%87-Offer-II-015-%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E7%9A%84%E6%89%80%E6%9C%89%E5%8F%98%E4%BD%8D%E8%AF%8D"><span class="toc-number">1.3.1.</span> <span class="toc-text">剑指 Offer II 015. 字符串中的所有变位词</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9B%BE"><span class="toc-number">1.4.</span> <span class="toc-text"> 图</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%8D%E5%88%B7%E4%BA%86"><span class="toc-number">2.</span> <span class="toc-text"> 不刷了</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/06/06/offer100/" title="剑指offer"><img src="/img/default_cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="剑指offer"/></a><div class="content"><a class="title" href="/2023/06/06/offer100/" title="剑指offer">剑指offer</a><time datetime="2023-06-06T10:30:42.000Z" title="发表于 2023-06-06 18:30:42">2023-06-06</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/09/aboutstream/" title="从 FileInputStream.read() 到 Windows api ReadFile()"><img src="/img/default_cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="从 FileInputStream.read() 到 Windows api ReadFile()"/></a><div class="content"><a class="title" href="/2023/05/09/aboutstream/" title="从 FileInputStream.read() 到 Windows api ReadFile()">从 FileInputStream.read() 到 Windows api ReadFile()</a><time datetime="2023-05-09T12:09:14.000Z" title="发表于 2023-05-09 20:09:14">2023-05-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/04/LeetCode-Hot-100/" title="LeetCode_Hot_100"><img src="/img/default_cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="LeetCode_Hot_100"/></a><div class="content"><a class="title" href="/2023/05/04/LeetCode-Hot-100/" title="LeetCode_Hot_100">LeetCode_Hot_100</a><time datetime="2023-05-04T12:14:51.000Z" title="发表于 2023-05-04 20:14:51">2023-05-04</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By jingxiao</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"></div><canvas class="fireworks" mobile="true"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/fireworks.min.js"></script><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="true" data-click="false"></script><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>